﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RearLivestock.Common.Domains.hq;
using RearLivestock.Common.Dtos;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.Ablactationss;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.Saless;

namespace RearLivestock.RBAC.Api.Controllers.hq
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SalesController : ControllerBase
    {
        private readonly IMediator imediator;
        public SalesController(IMediator imediator)
        {
            this.imediator = imediator;
        }

        /// <summary>
        /// 销售添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> addSalessCommand(AddSalessCommand cmd)
        {
            return await imediator.Send(cmd);
        }

        /// <summary>
        /// 销售显示
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result<PageResultDto<Sales>>> showSale(ShowSaleComand cmd)
        {
            return await imediator.Send(cmd);
        }
    }
}
